package com.peanut.huibutie.openapi;

import com.alibaba.fastjson.JSONObject;
import com.peanut.huibutie.common.AppConfig;
import com.peanut.huibutie.common.HttpInvoker;
import com.peanut.huibutie.common.OpenApiResult;
import com.peanut.huibutie.entity.PayResultVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 支付结果查询
 *
 * @see <a href="https://www.showdoc.com.cn/huibutie/10933753683106602">API</a>
 */
@Slf4j
@Service
public class PayResultQuery {
    @Resource
    private HttpInvoker httpInvoker;



    public void invoke(String orderVO) {

        JSONObject map = new JSONObject();
        map.put("outer_order_no", orderVO);
        OpenApiResult<PayResultVO> openApiResult = httpInvoker.sendPost(AppConfig.PayResultQuery_URL, map, PayResultVO.class);

        if (openApiResult.isSuccess()) {
            PayResultVO data = openApiResult.getData();
            log.info("支付结果查询，支付结果={}", data);
        }
    }
}
